package com.zkthink.ceres.file.service.impl;

import com.zkthink.base.R;
import com.zkthink.base.service.SuperServiceImpl;
import com.zkthink.ceres.file.dao.ExcelTemplateMapper;
import com.zkthink.ceres.file.dto.ExcelTemplatePageDTO;
import com.zkthink.ceres.file.entity.ExcelTemplate;
import com.zkthink.ceres.file.service.ExcelTemplateService;
import com.zkthink.ceres.file.vo.ExcelTemplateVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ExcelTemplateServiceImpl
 * @Description: ExcelTemplateServiceImpl
 * @Author ck
 * @Date 2021/1/22
 * @Version V1.0
 **/
@Slf4j
@Service
public class ExcelTemplateServiceImpl extends SuperServiceImpl<ExcelTemplateMapper, ExcelTemplate> implements ExcelTemplateService {
    @Autowired
    private ExcelTemplateMapper excelTemplateMapper;

    @Override
    public R<ExcelTemplateVO> selectByTemplateName(ExcelTemplatePageDTO dto) {
        List<ExcelTemplate> excelTemplates = excelTemplateMapper.selectByTemplateName(dto);
        ExcelTemplateVO vo = new ExcelTemplateVO();
        vo.setTotal(excelTemplateMapper.selectTotalByTemplateName(dto));
        vo.setExcelTemplate(excelTemplates);
        return R.success(vo);
    }

}
